//
//  Bootstrapper.swift
//  Service
//
//  Created by 蒋晨成 on 2021/12/23.
//

import Foundation
import Monitor
import Standard

public enum Bootstrapper {}

extension Bootstrapper: Bootable {
    @DelayInit
    public private(set) static var environment: Standard.Environmental

    public static func register(environment: Standard.Environmental) -> Self.Type {
        self.environment = environment
        return self
    }

    public static func bootstrap() -> Self.Type {
        guard let environment = environment as? Environmental else { fatalError("Environmental type error") }
        ReachabilityMonitor.start()
        PerformanceMonitor.start(appSecret: environment.appCenterSecret)
        return self
    }
}

extension Bootstrapper: TypeName {}
